package com.file;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

@SuppressWarnings({"all"})
public class Test_4 {
    public static void main(String[] args) {
        write();
    }
    public static void write(){
        String pathname="D:\\javacode\\javacode\\J2024_11_16\\write.txt";
        FileOutputStream fileOutputStream=null;
        String str="hello,world";

        try {
            fileOutputStream=new FileOutputStream(pathname,true);
            fileOutputStream.write(str.getBytes(),0,str.length());
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
        }
    }
}
